class Solution {
public:
    bool checkAlmostEquivalent(string word1, string word2) {
        int hash1[200] = {0} , hash2[200] = {0};
        for(auto ch: word1)
            hash1[ch]++;
        for(auto ch: word2)
            hash2[ch]++;
        for(char ch = 'a'; ch <= 'z'; ++ch)
            if(abs(hash1[ch] - hash2[ch]) > 3)
                return false;
        return true;
    }
};